//package com.shop2cn.iapi.img.testcase;
//
//import java.awt.Color;
//import java.awt.Font;
//import java.awt.image.BufferedImage;
//import java.io.File;
//import java.io.FileInputStream;
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.List;
//
//import javax.imageio.ImageIO;
//
//import org.apache.commons.codec.digest.DigestUtils;
//import org.junit.After;
//import org.junit.AfterClass;
//import org.junit.Before;
//import org.junit.BeforeClass;
//import org.junit.Ignore;
//import org.junit.Test;
//import org.junit.experimental.categories.Category;
//
//import com.drew.imaging.jpeg.JpegMetadataReader;
//import com.drew.metadata.Directory;
//import com.drew.metadata.Metadata;
//import com.drew.metadata.Tag;
//import com.shop2cn.iapi.img.parameter.UploadImageBean;
//import com.shop2cn.iapi.img.service.UploadImageCall;
//import com.ymatou.iapi.godmch.parameter.setShareTypeBean;
//import com.ymt.core.tool.Logger;
//import com.ymt.utils.annotation.TestCase;
//import com.ymt.utils.annotation.TestSuite;
//import com.ymt.utils.tag.P1;
//import com.ymt.utils.tag.P2;
//import com.ymttest.business.service.shenqi.GodmchManageCallService;
//import com.ymttest.utils.FontImage;
//import com.ymttest.utils.TestDataManager;
//import com.ymttest.utils.constant.ECode;
//
///**
// * 上传图片 FreeMaker Template自动生成代码
// */
//@TestSuite
//public class Ts_UploadImage {
//	private static UploadImageBean uploadbean;
//	private static UploadImageCall uploadcall;
//
//	@BeforeClass
//	public static void setUp() {
//		Logger.createResultFile("上传图片");
//	}
//
//	@Before
//	public void caseUp() {
//		uploadbean = new UploadImageBean();
//		uploadcall = new UploadImageCall();
//	}
//
//	@AfterClass
//	public static void tearDown() {
//		Logger.generateResult(uploadcall.getOpurl());
//		TestDataManager.removeTempFile();
//	}
//
//	@After
//	public void caseDown() {
//		Logger.end();
//	}
//
//	@Test
//	@Category(P1.class)
//	@TestCase
//	@Ignore
//	//神器站点不生成p图片
//	public void Tc_UploadImage_001() {
//		Logger.start(true, "上传product图片成功,_l_s_b_i图片生成");
//		try {
//			String type = "product";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_l");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_s");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_b");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_i");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_002() {
//		Logger.start(true, "上传userlogo图片成功,_s_m_b_lb图片生成(默认jpg图片)");
//		try {
//			String type = "userlogo";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_s");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_m");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_b");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_003() {
//		Logger.start(true, "上传catalog图片成功,_t图片生成");
//		try {
//			String type = "catalog";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_t");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	@Ignore
//	public void Tc_UploadImage_004() {
//		Logger.start(true, "上传shangou图片成功,_l_ls_lb图片生成");
//		try {
//			String type = "shangou";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_l");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_ls");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_005() {
//		Logger.start(true, "上传talk图片成功,_c图片生成");
//		try {
//			String type = "talk";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_c");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_006() {
//		Logger.start(true, "上传activity图片成功,_c图片生成");
//		try {
//			String type = "Activity";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_007() {
//		Logger.start(true, "上传ordershow图片成功,_c图片生成");
//		try {
//			String type = "ordershow";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_c");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	@Ignore
//	//规则变更
//	public void Tc_UploadImage_008() {
//		Logger.start(true, "上传apprecommendbanner图片成功,_s_w_p图片生成");
//		try {
//			String type = "apprecommendbanner";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_s");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_p");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_009() {
//		Logger.start(true, "上传gif图片成功");
//		try {
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "upload.gif";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl=turl.replace("_w", "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			File ff = new File(TestDataManager.DownloadFile(turl));
//			Logger.verifyEquals(true, TestDataManager.isPic(ff), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_010() {
//		Logger.start(true, "上传png图片成功");
//		try {
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "upload.png";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl=turl.replace("_w", "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			File ff = new File(TestDataManager.DownloadFile(turl));
//			Logger.verifyEquals(true, TestDataManager.isPic(ff), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_011() {
//		Logger.start(true, "上传bmp图片成功");
//		try {
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "upload.bmp";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl=turl.replace("_w", "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			File ff = new File(TestDataManager.DownloadFile(turl));
//			Logger.verifyEquals(true, TestDataManager.isPic(ff), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_012() {
//		Logger.start(true, "上传分辨率较大图片成功,_c图片生成");
//		try {
//			String type = "talk";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "upload.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_c");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_013() {
//		Logger.start(true, "上传shop图片成功,_s图片生成");
//		try {
//			String type = "shop";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_thumbnail");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P2.class)
//	@TestCase
////	@Ignore 修改此case可以查看性能
//	public void Tc_UploadImage_014() {
//		Logger.start(true, "重复上传shangou图片成功,MD5验证不会重复生成图片");
//		try {
//			String type = "product";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			for(int i=0;i<3;i++){
//				uploadcall=new UploadImageCall();
//				uploadcall.setData(uploadbean);
//				Logger.comment("添加上传文件:" + fliename);
//				uploadcall.addPart("file", fliename);
//				uploadcall.callService();
//				if(turl.length()>1) {
//					Logger.verifyEquals(turl,uploadcall.getPicUrl(),"MD5验证不会重复生成图片");
//				}
//				turl=uploadcall.getPicUrl();
//			}
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_015() {
//		Logger.start(true, "上传social图片成功,_s图片生成");
//		try {
//			String type = "social";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_s");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_t");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_016() {
//		Logger.start(true, "上传userlogo使用png图片成功,生成jpg图片,路径pic1.ymatou.com)JIRACONN-5421");
//		try {
//			String type = "userlogo";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "upload.png";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			Logger.verifyIsContains("jpg", uploadcall.getPicUrl(), "验证图片地址jpg");
//			Logger.verifyIsContains("jpg", uploadcall.getPicUrl(), "验证图片地址pic1.ymatou.com");
//			turl = changeUrl(uploadcall.getPicUrl(), "_s");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_m");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_b");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P1.class)
//	@TestCase
//	public void Tc_UploadImage_017() {
//		//isCheckMd5="false"
//		Logger.start(true, "social配置disconf,isCheckMd5=false,不校验md5");
//		try {
//			String type = "social";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "Penguins.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_s");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl = changeUrl(uploadcall.getPicUrl(), "_t");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			uploadcall.callService();
//			String turl2 = changeUrl(uploadcall.getPicUrl(), "_t");
//			Logger.debug(turl+":"+turl2);
//			Logger.verifyEquals(false,turl.equals(turl2), "不校验md5图片重复生成");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P1.class)
//	@TestCase
//	//http://jira.ymatou.cn:8080/browse/JIRACONN-30921
//	//md5不重传 请删除--select * from imagemd5.filemd5 where filemd5.FilePath=
//	public void Tc_UploadImage_018() {
//		Logger.start(true, "上传product图片成功,JIRACONN-30921修复JPG上传红图问题");
//		try {
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "origin.jpg";
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl=turl.replace("_w", "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			File ff = new File(TestDataManager.DownloadFile(turl));
//			Logger.verifyEquals(true, TestDataManager.isPic(ff), "验证" + turl
//					+ "是否是图片");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P1.class)
//	@TestCase
//	public void Tc_UploadImage_019() {
//		Logger.start(true, "上传share 图片成功,原始图片生成");
//		try {
//			String type = "share";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "idCard.jpg";
//			String fmd5 = DigestUtils.md5Hex(new FileInputStream(fliename));
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			String dfmd5 = DigestUtils.md5Hex(new FileInputStream(TestDataManager.DownloadFile(turl)));
//			Logger.debug(fmd5+":"+dfmd5);
//			Logger.verifyEquals(fmd5, dfmd5, "验证md5");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P1.class)
//	@TestCase
//	public void Tc_UploadImage_020() {
//		Logger.start(true, "上传shenqiProduct 图片成功,自动校正");
//		try {
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "111.jpg";
//			String fmd5 = DigestUtils.md5Hex(new FileInputStream(fliename));
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
////			turl = changeUrl(uploadcall.getPicUrl(), "_wk");
////			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
////					+ "是否是图片");
////			String dfmd5 = DigestUtils.md5Hex(new FileInputStream(TestDataManager.DownloadFile(turl)));
////			Logger.debug(fmd5+":"+dfmd5);
////			Logger.verifyEquals(fmd5, dfmd5, "验证md5");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P1.class)
//	@TestCase
//	public void Tc_UploadImage_021() {
//		Logger.start(true, "上传shenqiProduct 图片成功,自动校正-带水印");
//		try {
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			uploadbean.setWaterMark("test23===aaaa1");
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "111.jpg";
//			String fmd5 = DigestUtils.md5Hex(new FileInputStream(fliename));
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl=turl.replace("_w", "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			File ff = new File(TestDataManager.DownloadFile(turl));
//			Logger.verifyEquals(true, TestDataManager.isPic(ff), "验证" + turl
//					+ "是否是图片");
//			Metadata metadata = JpegMetadataReader.readMetadata(ff);
//	        Directory exif = metadata.getDirectories().iterator().next();
//	         Collection<Tag> tags = exif.getTags();
//	         String height=tags.stream().filter(t->{return t.getTagName().equals("Image Height");}).findFirst().get().getDescription();
//	         String width=tags.stream().filter(t->{return t.getTagName().equals("Image Width");}).findFirst().get().getDescription();
//	        Logger.verifyEquals(height, width, "验证方图");
//
//	        BufferedImage image = ImageIO.read(ff);
//	        int pixel = image.getRGB(1, 1);
//	        int rgbR = (pixel & 0xff0000) >> 16;
//	        int rgbG = (pixel & 0xff00) >> 8;
//	        int  rgbB = (pixel & 0xff);
//	        Logger.verifyNotEquals(255, rgbR, "验证非留白");
//	        Logger.verifyNotEquals(255, rgbG, "验证非留白");
//	        Logger.verifyNotEquals(255, rgbB, "验证非留白");
//
////			String dfmd5 = DigestUtils.md5Hex(new FileInputStream(TestDataManager.DownloadFile(turl)));
////			Logger.debug(fmd5+":"+dfmd5);
////			Logger.verifyEquals(fmd5, dfmd5, "验证md5");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P1.class)
//	@TestCase
//	public void Tc_UploadImage_022() {
//		Logger.start(true, "上传shenqiProduct图片成功,自动校正-带水印-带MchId参数");
//		try {
//			//oo  lb 没水印
//			//wo 有WaterMark 跟着WaterMark 没有看MchId 检查 godmchdb.mch_config 配置是否开启水印 如果MchId和ParentMchId同时存在看ParentMchId
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			uploadbean.setMchId(6002);
//			uploadbean.setParentMchId(6000);
////			uploadbean.setWaterMark("虎哥的店PRD");
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "111.jpg";
//			String fmd5 = DigestUtils.md5Hex(new FileInputStream(fliename));
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl=turl.replace("_w", "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
////			String dfmd5 = DigestUtils.md5Hex(new FileInputStream(TestDataManager.DownloadFile(turl)));
////			Logger.debug(fmd5+":"+dfmd5);
////			Logger.verifyEquals(fmd5, dfmd5, "验证md5");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category(P2.class)
//	@TestCase
//	public void Tc_UploadImage_023() {
//		Logger.start(true, "上传shenqiProduct图片成功,godseller留白");
//		try {
//			int userId_channl= GodmchManageCallService.CreateSellerMch();
//			setShareTypeBean initsetShareTypeV2 =GodmchManageCallService.initsetShareTypeV2(userId_channl);
//			initsetShareTypeV2.setProductPicAutoFill(true);//是否开启图片补白功能
//			GodmchManageCallService.setShareTypeV2Call(initsetShareTypeV2);
//
//			String type = "shenqiProduct";
//			String turl = "";
//			Logger.comment("setPicType:" + type);
//			uploadbean.setPicType(type);
//			uploadbean.setMchId(userId_channl);
//			uploadbean.setParentMchId(userId_channl);
////			uploadbean.setWaterMark("虎哥的店PRD");
//			String p1="./resource/a.jpg";
//			List<String> info=new ArrayList<String>();
//			info.add("添加水印测试:AutoTest:"+TestDataManager.getRandomUUID().toString());
//			FontImage.addWaterMark("./resource/Penguins.jpg",p1,info,new Font("黑体", Font.PLAIN, 30), FontImage.getColorFmtAlpha(Color.RED,0.9d),"jpg");
//			String fliename = System.getProperty("user.dir") + File.separator + "resource" + File.separator
//					+ "a.jpg";
//			String fmd5 = DigestUtils.md5Hex(new FileInputStream(fliename));
//			uploadcall.setData(uploadbean);
//			Logger.comment("添加上传文件:" + fliename);
//			uploadcall.addPart("file", fliename);
//
//			uploadcall.callService();
//
//			Logger.verifyEquals(ECode.SUCCESS, uploadcall.getStatus(), "验证Status");
//			Logger.verifyEquals(ECode.PIC_UPLOAD_SUCCESS, uploadcall.getMsg(), "验证Msg");
//			Logger.verifyNotNull(uploadcall.getPicUrl(), "验证图片地址非空");
//			turl = changeUrl(uploadcall.getPicUrl(), "_o");
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			turl=turl.replace("_w", "_o");
//
//			Logger.verifyEquals(true, TestDataManager.isPic(new File(TestDataManager.DownloadFile(turl))), "验证" + turl
//					+ "是否是图片");
//			File ff = new File(TestDataManager.DownloadFile(turl));
//			Metadata metadata = JpegMetadataReader.readMetadata(ff);
//	        Directory exif = metadata.getDirectories().iterator().next();
//	         Collection<Tag> tags = exif.getTags();
//	         String height=tags.stream().filter(t->{return t.getTagName().equals("Image Height");}).findFirst().get().getDescription();
//	         String width=tags.stream().filter(t->{return t.getTagName().equals("Image Width");}).findFirst().get().getDescription();
//	        Logger.verifyEquals(height, width, "验证方图");
//
//	        BufferedImage image = ImageIO.read(ff);
//	        int pixel = image.getRGB(1, 1);
//	        int rgbR = (pixel & 0xff0000) >> 16;
//	        int rgbG = (pixel & 0xff00) >> 8;
//	        int  rgbB = (pixel & 0xff);
//	        Logger.verifyEquals(255, rgbR, "验证留白");
//	        Logger.verifyEquals(255, rgbG, "验证留白");
//	        Logger.verifyEquals(255, rgbB, "验证留白");
//
//			turl = changeUrl(uploadcall.getPicUrl(), "_lb");
//
//			//方图
//			ff = new File(TestDataManager.DownloadFile(turl));
//			Logger.verifyEquals(true, TestDataManager.isPic(ff), "验证" + turl
//					+ "是否是图片");
//			metadata = JpegMetadataReader.readMetadata(ff);
//	        exif = metadata.getDirectories().iterator().next();
//	         tags = exif.getTags();
//	          height=tags.stream().filter(t->{return t.getTagName().equals("Image Height");}).findFirst().get().getDescription();
//	          width=tags.stream().filter(t->{return t.getTagName().equals("Image Width");}).findFirst().get().getDescription();
//	        Logger.verifyEquals(height, width, "验证方图");
//
//	         image = ImageIO.read(ff);
//	         pixel = image.getRGB(1, 1);
//	         rgbR = (pixel & 0xff0000) >> 16;
//	         rgbG = (pixel & 0xff00) >> 8;
//	         rgbB = (pixel & 0xff);
//	        Logger.verifyEquals(255, rgbR, "验证留白");
//	        Logger.verifyEquals(255, rgbG, "验证留白");
//	        Logger.verifyEquals(255, rgbB, "验证留白");
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	/**
//	 * 修改url地址，本case专用 用于在原来的地址文件名后加后缀
//	 *
//	 * @return 修改后的地址
//	 */
//	private static String changeUrl(String url, String suffix) {
//		return url.substring(0, url.lastIndexOf("_")) + suffix + url.substring(url.lastIndexOf("."), url.length());
//	}
//}